package ${basePackage}.data.om;

import com.baomidou.mybatisplus.annotation.*;
import com.jrapider.om.IdGetter;
import lombok.Getter;
import lombok.Setter;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;


<#macro dateFormate type>
<#if type=='date'>
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
<#elseif type=='time'>
    @JsonFormat(pattern = "HH:mm:ss")
    @DateTimeFormat(pattern="HH:mm:ss")
<#elseif type=='datetime' || type=='timestamp'>
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
</#if>
</#macro>

@Getter
@Setter
class _${entityName} implements IdGetter<Long> {

<#list fields as field>
    <#if field.ignoreEx?? && field.ignoreEx=="1">
    <#elseif field.primaryEx?? && field.primaryEx=="1">
    @TableId(type = IdType.AUTO)
    ${field.fieldType} ${field.field};
    <#else >
    <@dateFormate type=field.dbType></@dateFormate>
    ${field.fieldType} ${field.field};
    </#if>
</#list>


}
